{# 
  mode的取值有：
    full：该模式下显示折扣价、原价、打折
    price: 该模式下如有打折活动则显示折扣价，没有打折活动就显示为原价
    originPrice：该模式下只显示原价
    discount：该模式下只显示折扣
#}

{% set shows = shows|default(['full']) %}
{% set priceType = (setting('coin.coin_enabled') and setting('coin.price_type') == 'Coin') ? 'coin' : 'default'  %}

<span class="course-price-widget">
{% if course.isice %}
  <span class="price">{{ course.iceprice }} 元</span>
{% else %}
  {% if course.discountId %}

    {% if 'full' in shows or 'price' in shows %}
      {% if priceType == 'coin' %}
        <span class="price">{{ course.coinPrice }} {{setting('coin.coin_name', '虚拟币')}}</span>
      {% else %}
      <!--打折后的价格-->
        <span class="price">{{ course.price*(course.discount/10) }} 元</span>
      {% endif %}
    {% endif %}

    {% if 'full' in shows or 'originPrice' in shows %}
      {% if priceType == 'coin' %}
        <span class="origin-price"><del>{{course.originCoinPrice}} {{setting('coin.coin_name', '虚拟币')}}</del></span>
      {% else %}
        <span class="origin-price"><del>{{course.originPrice}} 元</del></span>
      {% endif %}
    {% endif %}

    {% if 'full' in shows or 'discount' in shows %}
    
      <span class="discount">
   
        {% if (course.discount == 0) or (priceType == 'coin' and course.originCoinPrice == 0) or (priceType == 'default' and course.originPrice == 0) %}
          限免
        {% else  %}
          {{ course.discount|round(2, 'common') }} 折
        {% endif %}
      </span>

    {% endif %}

  {% else %}

    {% if 'full' in shows or 'price' in shows %}
      <span class="price">
        {% if setting('coin.coin_enabled') and setting('coin.price_type') == 'Coin' %}
          {% if course.coinPrice > 0 %} {{ course.coinPrice }} {{setting('coin.coin_name', '虚拟币')}} {% else %} <span class="text-primary">免费</span> {% endif %}
        {% else %}
          {% if course.price > 0 %}{{ course.price }} 元{% else %} <span class="text-primary">免费</span> {% endif %}
        {% endif %}
      </span>
    {% endif %}

    {% if 'originPrice' in shows %}
      {% if priceType == 'coin' %}
        <span class="origin-price">{{course.originCoinPrice}} {{setting('coin.coin_name', '虚拟币')}}</span>
      {% else %}
        ¥<span class="origin-price">{{course.originPrice}}</span>
      {% endif %}
    {% endif %}

  {% endif %}
{% endif %}
</span>